通过python文件的Robot框架的命令行参数

您所在的位置:网站首页 python testsuite 通过python文件的Robot框架的命令行参数

通过python文件的Robot框架的命令行参数

#通过python文件的Robot框架的命令行参数| 来源: 网络整理| 查看: 265

通过python文件的Robot框架的命令行参数 2020-02-22 18:02:34 293 1 用户昵称 +关注

我想从命令提示符处将参数传递给python文件变量,然后通过将python文件添加为变量来从机器人文件中打印相同的参数。

cmd (Variables) --> python file --> robot (print those variables) 但是,显然没有一项尝试能取得预期的结果。任何指导将不胜感激。

注意: Robot和Python文件都在pycharm IDE中位于同一目录下。

命令行:-

1st try: robot -d Report -V test.py Test_sample.robot|py test.py [email protected] test@123 QA1 2nd try: robot -d Report Test_sample.robot|py test.py [email protected] test@123 QA1 3rd try: robot -d Report --Variablefile py test.py Test_sample.robot|py test.py [email protected] test@123 QA1 4th try: robot -d Report -V | py test.py [email protected] test@123 QA1| Test_sample.robot

蟒蛇:-

import sys username = str(sys.argv[1]) password = str(sys.argv[2]) environment = str(sys.argv[3]) 机器人:- *** Settings *** Library SeleniumLibrary Library Collections Variables test.py *** Test Cases *** Pass variables from Python File log to console The usr is: "${username}" log to console The pwd is: "${password}" log to console The env is: "${environment}"

预期:

usr是:[email protected] pwd是:test @ 123环境是:QA1 实际: [ ERROR ] Unexpected error: OSError: [Errno 22] Invalid argument Traceback (most recent call last): File "\python\python37-32\lib\site-packages\robot\utils\application.py", line 83, in _execute rc = self.main(arguments, **options) File "\python\python37-32\lib\site-packages\robot\run.py", line 439, in main result = suite.run(settings) File "\python\python37-32\lib\site-packages\robot\running\model.py", line 222, in run self.visit(runner) File "\python\python37-32\lib\site-packages\robot\model\testsuite.py", line 168, in visit visitor.visit_suite(self) File "\python\python37-32\lib\site-packages\robot\model\visitor.py", line 84, in visit_suite if self.start_suite(suite) is not False: File "\python\python37-32\lib\site-packages\robot\running\runner.py", line 83, in start_suite test_count=suite.test_count)) File "\python\python37-32\lib\site-packages\robot\output\output.py", line 51, in start_suite LOGGER.start_suite(suite) File "\python\python37-32\lib\site-packages\robot\output\logger.py", line 200, in start_suite logger.start_suite(suite) File "\python\python37-32\lib\site-packages\robot\output\console\verbose.py", line 35, in start_suite self._writer.suite_separator() File "\python\python37-32\lib\site-packages\robot\output\console\verbose.py", line 104, in suite_separator self._fill('=') File "\python\python37-32\lib\site-packages\robot\output\console\verbose.py", line 110, in _fill self._stdout.write('%s\n' % (char * self._width)) File "\python\python37-32\lib\site-packages\robot\output\console\highlighting.py", line 53, in write self.flush() File "\python\python37-32\lib\site-packages\robot\output\console\highlighting.py", line 66, in flush self.stream.flush() Exception ignored in: OSError: [Errno 22] Invalid argument IDE 机器人 开发工具 Python robot python框架 robot python函数 robot python工具ics robot python工具 robot python机器人工具 开发者社区 > 开发与运维 > 问答

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3